package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2088621956432383";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDQKIu5CafNGswbyZ0YLHtuqfhjO0ZCKVndTj5kSHzGsESW2xfHtqtPC3vMCw24XIdywUWFGPEDV0j67B8TxjS9Cth0UzV/H82AIcSrd4xodYGJ9miNrzfcGIA3BlDaloFydOCdh1K7+qLVt/qWNnDXS9OJCek63MG8XvhzsmsfQGesEz9nlcd7polQ4CP62BdE1qNZPZ/+8LKLysLbMJgHTTb4P/zGOe9r2ZoPvbxVmZVtel4gSN0WU6HX9sHEs6SczgPljdRmSfEtXX4wLlYJPog9ML3AOMt3AQ7d+Fsoj1qudc1bZHR+KPVc+6nuIWycNO1o1iRC9wUIdov3s9WHAgMBAAECggEAWnbkklxR4t+ciQ8MCO98DVItMuMV27cg6P8SOn8OS0Nb67v4D8Ghnc691KWRJuh/rS21yuxWAj+y5eosb2majfXisFthSohFxUPntyVTjipTS+Qc+EaIHk0/m6pRBU6Xn2iQHaYsHKoGjp9QdmveipLXshzukbhTMkyL6axGxeNs0GxnJqY/eazsQtHV+hLBrTuooAOcv+kqbiZ4BFDICW42ttFpm0ch1qRwwYLkoreZd82qGVyru82USvaDSsqUwWImfCPPCQ10Z/zZvP0WG4gM2uFdjCMKteLrfrjITsNPrPAtEcBOAf5PJUjYVjFl2Bk8am1gbKtYrpPoiIMAEQKBgQDxfyj6x8cn/XXJRtU7PAaSMBdjbfjpRdxYd1F2B1BIOimU5yWrtThmnagoXKlv10nFNdiLccZnydmGRHMEoGiz791G9wlgmvQLI+XPHotdWB+YSym1wVTCppbMvH3Qp9rkN97Bi1wJREwfbzSZOIokvMqE6jQ0OgUjip6y3CECNQKBgQDcqNUhvaczL8Y9yRfvTrrWBzwhz8xtffA3bYnDzjTecOsvsUnFKz6kx05D9+VFhal1lhruEXrhXidhTSFaOYGAjtJuZAsn6KHoN5VURbA+/dL77V6gL+y6MhDCkwzby6bCyckXjUG2HMrLlAET/VrFtgrlSfbHKBBWpMGnxu1wSwKBgFEjOx5+7r/V3bQhc1Tyhvao58LFWSLvEOg8NodkT6nkuMHJo5N8UJXRlITzFQ55k9SJkdbQBCws2kPNTaOZTXRfO8YzC9iEV0hC6FxdU8+p4vulDT9+1D6OAA6Lqe3n55hT2SjH7MVESBsrns13/Jn5QEXF9oIxmDZnxYgsg36dAoGBALlPWF5TpZ0JHBU7Ukx489NWlBtZJbc2Mox6A15bSG8eqYSOAQQCw0Mi1gmin/r4u02y177jEy09IxlF6yKYdLeAOhzXC79iUMZyF4iEVfUwuQU1XWhtlwLvlL+zOvNDXjLrv2N2D59fIrhA/X7KIHc14ISazxKGBOKezruWBkVtAoGBAOcJSJcSjs9SEvlTSSDsjyVcNdSvAkRcZKNqemAO32He1ZemjZb6UHrAb87/EZGegWmiVAX04fjSbrMPNw9RRAJbaRSl04yTzzQrcg4pvE9ZMnOu+Ks2eelAQ6QIUe53obDGITZLfMaNv/655EuL1R3T+Bj3maY+r59fd3OZP6l2";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3QLypV3TAdBhC2w+WaPUe8tBYeVrrkneJf+Vj86kGkS3QTt0cPHAiTgznJsbkrBs4/PnAmB8NAIJ1yZytLdkHdxLLd1Yqm115bPeSuCZdBRQKXuJ0FjCtYtuOr4wPEdspBrNO7BCDVJbpDWNXqePUUsjCAp5qTNgJsW8p3UObMHaemecaXM4DdtgzNIEro2UsX3fpmCa0NAwZiRBYBRsrIYcrPE1ddmzlhFH0HSQCjOvYo8o0AZAMtL471N16SijirYcKDGuhm5r8Yfx5mT/eLxE3YtcQMEUQvGzw5q2lhg9QInK+IMMT/DhJ+Ep5QTe+AomwnM1GOAjwRGY10i74wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl =  "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

